update/requery db
am 24.10.2007 17:40:49 von daniel
Hello,
I have setup a table with 1 row and 2 columns.In the 1st, I have a
iframe that displays tons thumbnails of images. In the next I have an
image (enlarged). When the user selects a thumbnail it displays the
enlarged image in the 2nd column. This work quite nicely.
Where I need some help is with the fact that each image has an entry
(description in a database table). How can I display the entry when
the image is updated. The image gets updated using javascript but the
page itself is php (as is the rest of the site). I do not want to
reload the page everytime (long and waste of badnwidth).
Thank you for your guidance,
Daniel
Re: update/requery db
am 24.10.2007 18:53:43 von Shelly
"Daniel" wrote in message
news:1193240449.951029.25510@q3g2000prf.googlegroups.com...
> Hello,
>
> I have setup a table with 1 row and 2 columns.In the 1st, I have a
> iframe that displays tons thumbnails of images. In the next I have an
> image (enlarged). When the user selects a thumbnail it displays the
> enlarged image in the 2nd column. This work quite nicely.
>
> Where I need some help is with the fact that each image has an entry
> (description in a database table). How can I display the entry when
> the image is updated. The image gets updated using javascript but the
> page itself is php (as is the rest of the site). I do not want to
> reload the page everytime (long and waste of badnwidth).
>
> Thank you for your guidance,
>
> Daniel
One way is to have an array of the info built with an entry for each of the
thumbnails. In the second column have the info for that array entry appear
along with the enlarged image.
Re: update/requery db
am 24.10.2007 19:07:48 von daniel
Shelly,
I had this in the back of my head, but do not know how to approach
it. How can you build an array in memory an change the text
accordingly. Any chance you could give an example?!
Thank you,
Daniel
On Oct 24, 12:53 pm, "Shelly" wrote:
> "Daniel" wrote in message
>
> news:1193240449.951029.25510@q3g2000prf.googlegroups.com...
>
>
>
>
>
> > Hello,
>
> > I have setup a table with 1 row and 2 columns.In the 1st, I have a
> > iframe that displays tons thumbnails of images. In the next I have an
> > image (enlarged). When the user selects a thumbnail it displays the
> > enlarged image in the 2nd column. This work quite nicely.
>
> > Where I need some help is with the fact that each image has an entry
> > (description in a database table). How can I display the entry when
> > the image is updated. The image gets updated using javascript but the
> > page itself is php (as is the rest of the site). I do not want to
> > reload the page everytime (long and waste of badnwidth).
>
> > Thank you for your guidance,
>
> > Daniel
>
> One way is to have an array of the info built with an entry for each of the
> thumbnails. In the second column have the info for that array entry appear
> along with the enlarged image.- Hide quoted text -
>
> - Show quoted text -
Re: update/requery db
am 24.10.2007 19:50:59 von Shelly
"Daniel" wrote in message
news:1193245668.179512.149720@q3g2000prf.googlegroups.com...
> Shelly,
>
> I had this in the back of my head, but do not know how to approach
> it. How can you build an array in memory an change the text
> accordingly. Any chance you could give an example?!
>
> Thank you,
>
> Daniel
Show us your code for that page. It would make things easier for people to
help. Specifically, exactly what code are you using to refresh the enlarged
image area?
In **general**, one way to build the array (put in your appropiate error
checking, of course) is:
$res = $mysql_query("the_query_string", the_db_handle);
$numElementInArray = mysql_num_rows($res);
$theArray = array();
for ($i=0; $i<$numElementInArray; $i++) {
$row = mysql_fetch_array($res);
$theArray[$i] = $row['identifier'];
}
Then in the appropriate field in the html area you might have something
like:
where, of course, $i corresponds to the index of the particular thumbnail
selected (its value).
More or less, this is the kind of thing you would be doing.
Re: update/requery db
am 24.10.2007 22:47:28 von daniel
Shelly,
Below is what I have so far. Near the very end I placed a comment
where I am aiming to make the description appear. I am wishing it to
cycle as the images do. So dynamic image and description.
Database info
db name: images
db user: webuser
db pwd: 1az2301
db tbl: images
In the table there are 2 fields of interest: filename which is also
the src used for the thumbnail and desc which is the description for
that image.
Thank you once again for all your help!
Daniel
****************************************************
charset=3Diso-8859-1" />
Untitled Document
Re: update/requery db
am 24.10.2007 23:08:40 von daniel
I found a method, maybe not the best, but it is functional. I simply
generate the page while adding a 2nd variable to the onclick event for
each image where I place the description. Then mod the onclick event
to populate the innerHtml for the element.
Only issue is the 2nd variable can be up to 255 chrs. If you have
another method, I am all ears!
Thank you,